Before understanding what a virtual machine is we should get familiar with what a physical machine is. When we buy a physical computer it comes with CPU, memory (Ram), NICs, storage devices and adapters to connect to disk. Then we install some operating systems like Windows or Linux. The hardware is controlled by the operating system and it also controls the resources that are to be allocated to the application programs running in the system.
Now let’s talk about about a virtual machine (VM). Instead of a physical system, that is replaced by a host which runs hypervisor on it. We’re not going to run applications on this physical system. We’re going to run virtual machines each with their independent operating system. Some of these VMs could be windows virtual machines, some could be Linux. It doesn’t matter. In this case, the virtual machines are still running on the same physical system. It will still have memory and CPU and physical network interface cards and possibly storage adapters, and local storage. We install a hypervisor on it instead of installing Windows or Linux.
Hypervisors act as the intermediary. They interpose themselves between the virtual machines and the hardware. This is the magic sauce that makes virtualization work. Now all VMs can share a common set of physical hardware.
We can have a bunch of virtual machines each with their independent operating system sharing a common set of memory CPU, physical network interface cards and storage adapters as well. When the virtual machine goes to access hardware, it is utilizing the memory, CPU and all of the physical resources of the host. The hypervisor is the thing that’s in control of those physical resources. The hypervisor has direct access to the physical hardware and it’s controlling which virtual machines get access to how much memory and CPU.
Image URL
https://en.wikipedia.org/wiki/Virtual_machine#/media/File:Hardware_Virtualization_(copy).svg
Type 1 Hypervisor: a type 1 hypervisor can also be called “bare-metal hypervisor”. This is because we install the hypervisor directly on a physical server. It’s essentially the operating system that runs on that physical server and it provides this hypervisor capability to run multiple VM to run on top of it. Hardware is directly accessed by the type 1 hypervisor. A few examples of type 1 Hypervisor are VMware ESXi Server, Microsoft Hyper-V, and Citrix/Xen Server.
Image URL: https://en.wikipedia.org/wiki/Hypervisor#/media/File:H yperviseur.png
Type 2 Hypervisor: type 2 hypervisor is also called a hosted hypervisor. This is where a Virtual Machine Manager is installed on top of any operating system. In the case of type 2 hypervisor, we buy a physical server and install any operating system on it. That can be any operating system - Mac, Windows or Linux. Type 2 hypervisors are installed on top of the operating system. Examples of type 2 are VMware Workstation, Microsoft Virtual PC and Oracle Virtual Box.
ESXi is a type 1 hypervisor that is installed on bare-metal hardware just like an operating system. Optimal hardware requirements for ESXi are 2CPU Cores and 4GB Ram. ESXi’s interface is accessed by a vSphere web-based interface.
Image URL : https://en.wikipedia.org/wiki/VMware_ESXi#/media/File:VMwareESXiHostClientSummary.png